
const { spawn } = require('child_process');

const commandSpawn = (...args) => {
    return new Promise((resolve, reject) => {
        const childProcess = spawn(...args);
        // 下载执行时的进程打印 成功下载或失败下载
        childProcess.stdout.pipe(process.stdout);
        childProcess.stderr.pipe(process.stderr);
        // 下载执行完毕
        childProcess.on("close", () => {
            resolve();
        })
    })
}

module.exports = {
    commandSpawn
}